#include "data_struct/base/DataSet.h"
#include "modules/MonitorModule/FanBlockMonitor.h"
#include "modules/CtrlModule/PassivePlanner/FanBlockPlanner.h"

namespace  behavior_controller
{
    #define MAX_FAN_POWER 200
    #define FAN_SPEED 0.2
    #define MAX_CURRENT 2
    FanBlockMonitor fan_block_monitor;
    void FanBlockMonitor::run()
    {
        if(fan_block_planner.finished)
        {
            bool is_block=false;
            if((DataSet::motor_data.power_fan_motor()>=MAX_FAN_POWER  &&
                DataSet::motor_data.fan_speed()>=FAN_SPEED)       &&
                DataSet::motor_data.overcurrent_flag()>=MAX_CURRENT)
            {
                is_block=true;
            }
            if(is_block)
            {
                DataSet::ctrl_state = FAN_BLOCK_PLAN;
                fan_block_planner.finished=false;
                std::cout<< "fan_block  bad !"<< std::endl;
            }
        }
    }
}